package com.julinggame.nettyim;

import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum MessageType {
    /**
     * 私聊
     */
    PRIVATE(1),
    /**
     * 群聊
     */
    GROUP(2),
    /**
     * 错误
     */
    ERROR(-1);

    private Integer type;

    public static MessageType match(Integer type) {
        for (MessageType messageType : MessageType.values()) {
            if (messageType.getType().equals(type)) {
                return messageType;
            }
        }
        return ERROR;
    }
}
